//
//  AYSCategoryView.m
//  AiYingShiProject
//
//  Created by lanou on 15/10/27.
//  Copyright © 2015年 李晓理. All rights reserved.
//

#import "AYSCategoryView.h"
#import "AYSILView.h"
#define Start_X 37.0f           // 第一个按钮的X坐标
#define Start_Y _zyButton.frame.size.height * 3 + 50         // 第一个按钮的Y坐标
#define Width_Space 45.0f        // 2个按钮之间的横间距
#define Height_Space 20.0f      // 竖间距
#define Button_Height 70.0f    // 高
#define Button_Width 70.0f      // 宽

@interface AYSCategoryView ()

@property (nonatomic, strong) UIButton *movieButton;
@property (nonatomic, strong) UIButton *tvButton;
@property (nonatomic, strong) UIButton *cartonButton;
@property(nonatomic, strong)UILabel *smallNameLabel;
@property(nonatomic, strong)UILabel *movieLabel;
@property(nonatomic, strong)UILabel *tvLabel;
@property(nonatomic, strong)UILabel *dmLabel;
@property(nonatomic, strong)UILabel *zyLable;
@end

@implementation AYSCategoryView

- (void)didClickMovieButton:(UIButton *)sender
{
    self.movieButtonBlock();
}

- (void)didClickTVButton:(UIButton *)sender
{
    self.tvButtonBlock();
}

- (void)didClickCartonButton:(UIButton *)sender
{
    self.cartonButtonBlock();
}

- (void)didClickZYButton:(UIButton *)sender
{
    self.zyButtonBlock();
}


- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self)
    {
        self.backgroundColor = [UIColor blackColor];
        
        _movieButton = [UIButton buttonWithType:(UIButtonTypeCustom)];
        _movieButton.frame = CGRectMake(10, frame.origin.y + 10, (frame.size.width - 30) / 2, SCREEN_HEIGHT / 7);
        _movieButton.layer.cornerRadius = 8;
        _movieButton.imageView.layer.cornerRadius = 8;
        [_movieButton setImage:[UIImage imageNamed:@"电影1"] forState:(UIControlStateNormal)];
        [_movieButton addTarget:self action:@selector(didClickMovieButton:) forControlEvents:(UIControlEventTouchUpInside)];
        [self addSubview:_movieButton];
        
        _movieLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, CGRectGetMidY(_movieButton.bounds) - 15, _movieButton.frame.size.width, 30)];
        _movieLabel.text = @"电影";
        _movieLabel.font = [UIFont boldSystemFontOfSize:20];
        _movieLabel.textColor = [UIColor whiteColor];
        _movieLabel.textAlignment = NSTextAlignmentCenter;
        [self.movieButton addSubview:_movieLabel];
        
        _tvButton = [UIButton buttonWithType:(UIButtonTypeCustom)];
        _tvButton.frame = CGRectMake(CGRectGetMaxX(_movieButton.frame) + 10, _movieButton.frame.origin.y, _movieButton.frame.size.width, _movieButton.frame.size.height);
        _tvButton.layer.cornerRadius = 8;
        _tvButton.imageView.layer.cornerRadius = 8;
        [_tvButton setImage:[UIImage imageNamed:@"电视剧1"] forState:(UIControlStateNormal)];
        [_tvButton addTarget:self action:@selector(didClickTVButton:) forControlEvents:(UIControlEventTouchUpInside)];
        [self addSubview:_tvButton];
        
        _tvLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, CGRectGetMidY(_tvButton.bounds) - 15, _tvButton.frame.size.width, 30)];
        _tvLabel.text = @"电视剧";
        _tvLabel.font = [UIFont boldSystemFontOfSize:20];
        _tvLabel.textColor = [UIColor whiteColor];
        _tvLabel.textAlignment = NSTextAlignmentCenter;
        [self.tvButton addSubview:_tvLabel];
        
        
        _cartonButton = [UIButton buttonWithType:(UIButtonTypeCustom)];
        _cartonButton.frame = CGRectMake(_movieButton.frame.origin.x, CGRectGetMaxY(_movieButton.frame) + 10, _movieButton.frame.size.width, _movieButton.frame.size.height);
        _cartonButton.layer.cornerRadius = 8;
        _cartonButton.imageView.layer.cornerRadius = 8;
        [_cartonButton setImage:[UIImage imageNamed:@"动漫1"] forState:(UIControlStateNormal)];
        [_cartonButton addTarget:self action:@selector(didClickCartonButton:) forControlEvents:(UIControlEventTouchUpInside)];
        [self addSubview:_cartonButton];
        
        _dmLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, CGRectGetMidY(_cartonButton.bounds) - 15, _cartonButton.frame.size.width, 30)];
        _dmLabel.text = @"动漫";
        _dmLabel.font = [UIFont boldSystemFontOfSize:20];
        _dmLabel.textColor = [UIColor whiteColor];
        _dmLabel.textAlignment = NSTextAlignmentCenter;
        [self.cartonButton addSubview:_dmLabel];
        
        _zyButton = [UIButton buttonWithType:(UIButtonTypeCustom)];
        _zyButton.frame = CGRectMake(_tvButton.frame.origin.x, _cartonButton.frame.origin.y, _movieButton.frame.size.width, _movieButton.frame.size.height);
        _zyButton.layer.cornerRadius = 8;
        _zyButton.imageView.layer.cornerRadius = 8;
        [_zyButton setImage:[UIImage imageNamed:@"综艺1"] forState:(UIControlStateNormal)];
        [_zyButton addTarget:self action:@selector(didClickZYButton:) forControlEvents:(UIControlEventTouchUpInside)];
        [self addSubview:_zyButton];
        
        _zyLable = [[UILabel alloc] initWithFrame:CGRectMake(0, CGRectGetMidY(_zyButton.bounds) - 15, _zyButton.frame.size.width, 30)];
        _zyLable.text = @"综艺";
        _zyLable.font = [UIFont boldSystemFontOfSize:20];
        _zyLable.textColor = [UIColor whiteColor];
        _zyLable.textAlignment = NSTextAlignmentCenter;
        [self.zyButton addSubview:_zyLable];
        
        _smallNameLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, CGRectGetMaxY(_zyButton.frame) + 10, SCREEN_WIDTH, 20)];
        _smallNameLabel.text = @"小视频集锦";
        _smallNameLabel.font = [UIFont systemFontOfSize:17];
        _smallNameLabel.textColor = [UIColor whiteColor];
        _smallNameLabel.textAlignment = NSTextAlignmentCenter;
        [self addSubview:_smallNameLabel];
        
                
    }
    return self;
}



@end
